package com.itheima.controller;

import com.itheima.entity.User;
import com.itheima.service.IUserService;
import com.itheima.util.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Yzq
 * @date 2022/10/10
 **/
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @PostMapping("/login")
    public Result login(@RequestBody User user){
        return userService.login(user);
    }

    /**
     * 退出登录
     * @return
     */
    @PostMapping("/loginout")
    public Result logout(){
        return userService.logout();
    }
}
